<?php
/**
 * jishupu-cms
 * @Author:技术铺<jishupu@qq.com>
 * @Date: 2022/3/16
 */

namespace App\Filters;

/**
 * 信息模块过滤器
 *
 * Class InfoFilter
 * @package App\Filters
 */
class InfoFilter extends BaseFilter
{
    /**
     * 关键词检索
     * @param $keywords
     */
    protected function keywords($keywords)
    {
        if (filled($keywords)) {
            return $this->builder->where('title', 'like', '%' . $keywords . '%')->orWhere('keywords', 'like', '%' . $keywords . '%');
        }
    }

    /**
     * 状态
     * @param $status
     * @return mixed
     */
    /*    protected function status($status)
        {
            if (filled($status)) {
                return $this->builder->where('status', $status);
            }
        }*/

    /**
     * 是否置顶
     * @param $top
     * @return mixed
     */
    /*    protected function top($top)
        {
            if (filled($top)) {
                return $this->builder->where('top', $top);
            }
        }*/


    /**
     * 创建时间范围
     * @param $created_at
     * @return mixed
     */
    /*    protected function createdAt($created_at = [])
        {
            if (!empty($created_at)) {
                return $this->builder->whereBetween('created_at', $created_at);
            }
        }*/


    /**
     * 推荐类型
     * @param $recommend_type
     * @return mixed
     */
    /*    protected function recommendType($recommend_type = [])
        {
            if (!empty($recommend_type)) {
                return $this->builder->whereRaw('FIND_IN_SET(?,recommend_type)', $recommend_type);
            }
        }*/

}
